<template>
  <div class="promiseContent">
    <el-form ref="ledgerForm" :model="ledgerForm" label-width="120px" class="el-dialog__body">
      <el-row>
        <el-col :span="10" class="coltitle">
          <el-form-item label="项目编号">
            <el-row>
              <el-col :span="18">
                <el-input v-model="form.projectId" disabled></el-input>
              </el-col>
              <el-col :span="6">
                <el-button :disabled="formDisplay" @click="showProjectDialog">请选择</el-button>
              </el-col>
            </el-row>
          </el-form-item>
        </el-col>
        <el-col :span="14" class="coltitle">
          <el-form-item label="项目名称">
            <el-input v-model="form.projectName"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <div class="title">承诺说明</div>
      <el-row>
        111
      </el-row>
      <div class="title">签字确认</div>
      <el-row>
        签字提交后默认同意网签，承诺遵守审计承诺书各项承诺。
      </el-row>
      <el-row style="padding: 100px 20% 0 0; text-align: right;">
        签字日期：
      </el-row>
    </el-form>
    <div class="promiseContent_bot">
      <el-button icon="el-icon-close" size="small" @click="cancelDialog">关闭</el-button>
      <el-button v-show="!formDisplay" icon="el-icon-check" size="small" type="primary" @click="projectSubmit">保存</el-button>
    </div>
    <ChoseProject :projectDialog="projectDialog" @cancelDialog="closeProjectDialog" @setValue="projectDataHandle"/>
  </div>
</template>

<script>
import {mapGetters} from "vuex";
import ChoseProject from "@/components/audited/ChoseProject";

export default {
  directives: {
    print
  },
  components: {
    ChoseProject
  },
  // dictTypes: ['pay_type', 'deal_type', 'resource_usage'],
  data() {
    return {
      form: {
        renterName: '',
      },
      projectDialog: false,
    }
  },
  computed: {
    ...mapGetters(["permissions"])
  },
  created() {
    // this.onLoad(this.page);
    this.Authorization = 'Bearer ' + this.$store.getters.access_token
  },
  methods: {
    showProjectDialog() {
      this.projectDialog = true
    },
    closeProjectDialog() {
      this.projectDialog = false
      console.log(this.form)
    },
    projectDataHandle(row) {
      this.projectDialog = false
      this.templateForm = this.form
      let combinedFormData = Object.assign({}, this.form, row);
      this.$set(this, "form", combinedFormData);
    },
  }
};
</script>

<style>
.promiseContent {
  display: flex;
  padding-bottom: 70px;
  background-color: #ffffff;
}
.promiseContent .title {
    color: #222222!important;
    border-bottom: 0!important;
    font-size: 14px;
    font-weight: bold;
    line-height: 30px;
    width: 100%;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    padding: 0 10px;
    margin: 10px 0;
    background-color: #f7f7f7;
  }
  .promiseContent .title::before {
    content: '';
    display: inline-block;
    height: 12px;
    width: 6px;
    background: #409EFF;
    margin-right: 5px;
    top: 5px;
  }
  .promiseContent .el-dialog__body {
    width: 100%;
  }
  .promiseContent_bot {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    padding: 10px 15px 0;
    background-color: #EBEEF5;
    text-align: center;
  }
</style>
